home *** CD-ROM | disk | FTP | other *** search
- /*
- * Selectors.c
- *
- * WASTE PROJECT
- * WEGetInfo / WESetInfo
- *
- * Copyright (c) 1993-1994 Marco Piovanelli
- * All Rights Reserved
- *
- */
-
- #include "WASTEIntf.h"
-
- WELookupTable _WEMainSelectorTable[] = {
- { 'clik', 0x0064, 0x0004 },
- { 'drag', 0x0094, 0x0004 },
- { 'line', 0x0008, 0x0004 },
- { 'port', 0x0000, 0x0004 },
- { 'post', 0x0090, 0x0004 },
- { 'pre ', 0x008C, 0x0004 },
- { 'refc', 0x007C, 0x0004 },
- { 'runa', 0x0010, 0x0004 },
- { 'scrl', 0x0074, 0x0004 },
- { 'styl', 0x000C, 0x0004 },
- { 'text', 0x0004, 0x0004 },
- { 'tsmd', 0x0080, 0x0004 },
- { 0 , 0x0000, 0x0000 }
- };
-
- WELookupTable _WEObjectHandlerSelectorTable[] = {
- { 'clik', 0x0010, 0x0004 },
- { 'curs', 0x0014, 0x0004 },
- { 'draw', 0x000C, 0x0004 },
- { 'free', 0x0008, 0x0004 },
- { 'new ', 0x0004, 0x0004 },
- { 0 , 0x0000, 0x0000 }
- };
-
- pascal void _WELookupSelector(WELookupTable *table, OSType selector, WEFieldDescriptor *desc)
- {
- for ( ; table->selector != selector ; table++ )
- if ( * (long *) &(table->desc) == 0L )
- break;
-
- *desc = table->desc;
- }
-
- pascal OSErr _WEGetField(WELookupTable *table, OSType selector, long *info, void *structure)
- {
- WEFieldDescriptor desc;
-
- _WELookupSelector(table, selector, &desc);
-
- if (desc.fLength == 0)
- return weUndefinedSelectorErr;
-
- *info = * (long *) ((long) structure + desc.fOffset);
- return noErr;
- }
-
- pascal OSErr _WESetField(WELookupTable *table, OSType selector, long *info, void *structure)
- {
- WEFieldDescriptor desc;
-
- _WELookupSelector(table, selector, &desc);
-
- if (desc.fLength == 0)
- return weUndefinedSelectorErr;
-
- * (long *) ((long) structure + desc.fOffset) = *info;
- return noErr;
- }
-
-
- pascal OSErr WEGetInfo(OSType selector, void *info, WEHandle hWE)
- {
- return _WEGetField(_WEMainSelectorTable, selector, (long *)info, (void *)*hWE);
- } // { WEGetInfo }
-
- pascal OSErr WESetInfo(OSType selector, const void *info, WEHandle hWE)
- {
- return _WESetField(_WEMainSelectorTable, selector, (long *)info, (void *)*hWE);
- } // { WESetInfo }
-
-